<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@include file="../../common/taglib.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@include file="../../common/common-css.jsp" %>
<%@include file="../../common/common-js.jsp" %>
<%@include file="../../common/init.jsp" %>
<link rel="stylesheet" type="text/css"
	href="${pageContext.servletContext.contextPath }/css/fenyecss.css" />
<script type="text/javascript">
function permissio(id){
	 var url = "${pageContext.servletContext.contextPath }/background/resources/permissioUser.html?userId="+id;
	 var h_sp1 = 400;
	 var w_sp1 = 350;
	//兼容IE，firefox,google.模态窗口居中问题
	 var iTop2 = (window.screen.availHeight - 20 - h_sp1) / 2;
	 var iLeft2 = (window.screen.availWidth - 10 - w_sp1) / 2;
	 var params = 'menubar:no;dialogHeight=' + h_sp1 + 'px;dialogWidth=' + w_sp1 + 'px;dialogLeft=' + iLeft2 + 'px;dialogTop=' + iTop2 + 'px;resizable=yes;scrollbars=0;resizeable=0;center=yes;location:no;status:no;scroll:no'
	 window.showModalDialog(url, window, params);
	 //location.href=url;
}
function userRole(id){
	 var url = "${pageContext.servletContext.contextPath }/background/user/userRole.html?userId="+id;
	 var h_sp1 = 420;
	 var w_sp1 = 600;
	//兼容IE，firefox,google.模态窗口居中问题
	 var iTop2 = (window.screen.availHeight - 20 - h_sp1) / 2;
	 var iLeft2 = (window.screen.availWidth - 10 - w_sp1) / 2;
	 var params = 'menubar:no;dialogHeight=' + h_sp1 + 'px;dialogWidth=' + w_sp1 + 'px;dialogLeft=' + iLeft2 + 'px;dialogTop=' + iTop2 + 'px;resizable=yes;scrollbars=0;resizeable=0;center=yes;location:no;status:no;scroll:no'
	 window.showModalDialog(url, window, params);
	 //location.href=url;
}
</script>
</head>
<body>
<div style="height: 100%;overflow-y: auto;">
<form id="fenye" name="fenye" action="${pageContext.servletContext.contextPath }/background/user/query.html" method="post">
<div class="right" >
        	<div class="volume">
            	<img src="${pageContext.servletContext.contextPath }/images/toleft.png" style="margin:23px 0 0 2px;_margin:23px 0 0 0px;" />
            </div>
        	<div class="rightcon ">
            	<div class="title">
                	您当前的位置：首页 > 用户管理 > 用户列表
                </div>
                  <input type="hidden" name="pageNow" id="pageNow"/>
                <table border="0" cellpadding="0" cellspacing="0" class="table1">
                	<tr>
                    	<td class="odd">用户名：
                        </td>
                        <td class="even"><input type="text" name="userName" value="${param.userName}" style="height: 20px"/>
                        </td>
                        <td class="odd">昵称：
                        </td>
                        <td class="even"><input type="text" name="userNickname" value="${param.userNickname}" style="height: 20px"/>
                        </td>
                        <td class="odd"  rowspan="2"  >
                        	<div class="button" >
                        	<input type="image" src="${pageContext.servletContext.contextPath }/images/cx.png" width="101" height="46"/>
                        	</div>
                        </td>
                    </tr>
                </table>
                 <table border="0" cellpadding="0" cellspacing="0" class="table2">
                 	<tr class="title">
                        <td width="20%" align="center">
                        	用户名
                        </td>
                         <td width="10%" align="center">
                        	所属角色
                        </td>
                        <td  width="10%" align="center">
                        	昵称
                        </td>
                         <td  width="15%" align="center">
                        	注册时间
                        </td>
                         <td  width="15%" align="center">
                        	最后一次登录时间
                        </td>
                        <td  width="5%" align="center">
                        	等级
                        </td>
                        <td width="20%" style=" border-right:none;" align="center">
                        	操作
                        </td>
                    </tr>
                   <c:forEach var="key" items="${pageView.records}">
                    <tr class="odd">
                        <td align="center">
                        	${key.userName}
                         <td align="center">
                        	${key.roleName}
                        </td>
                        <td align="center">
                        	${key.userNickname}
                        </td>
                        <td  align="center">
                        	<fmt:parseDate value="${key.regTime}" var="date" pattern="yyyy-MM-dd HH:mm:ss" />
			<fmt:formatDate value="${date}" pattern="yyyy-MM-dd HH:mm:ss" />
                        </td>
                        <td  align="center">
                        	<fmt:parseDate value="${key.lastLogintime}" var="date" pattern="yyyy-MM-dd HH:mm:ss" />
			<fmt:formatDate value="${date}" pattern="yyyy-MM-dd HH:mm:ss" />
                        </td>
                        <td  align="center">
                        	${key.levels}
                        </td>
                        <td  style=" border-right:none;" align="center">
                        	 <sec:authorize ifAnyGranted="ROLE_sys_user_fenpeirole">
            	<a href="javascript:void(0);" onclick="userRole('${key.userId}')">
            	分配角色</a>
            </sec:authorize>
            <sec:authorize ifAnyGranted="ROLE_sys_user_permissions">
            	<a href="javascript:void(0);" onclick="permissio('${key.userId}')">分配权限</a>
            </sec:authorize>
            <sec:authorize ifAnyGranted="ROLE_sys_user_edit">
            <a href="${pageContext.servletContext.contextPath }/background/user/getById.html?userId=${key.userId}&&type=1">
                                     编辑
            </a>
           </sec:authorize>
           <sec:authorize ifAnyGranted="ROLE_sys_user_delete">
            	<a href="javascript:void(0);" onclick="deleteId('${pageContext.servletContext.contextPath }/background/user/deleteById.html?userId=${key.userId}');">
            	删除</a>
            	</sec:authorize>
                        </td>
                    </tr>
                    </c:forEach>
                    <tr>
                    <%@include file="../../common/webfenye.jsp" %>
                    </tr>
                 </table>
                
            </div><!--rightcon-->
        </div>     
</form>
</div>
</body>
</html>